package geeksforgeeks.trees;

import geeksforgeeks.trees.TreeTraversals.Node;

public class LeafCount {
	
	public static void main(String[] args) {
		Node root = new Node(1);

		root.left = new Node(2);
		root.left.left = new Node(4);
		root.left.right = new Node(5);

		/*root.left.right.left = new Node(10);
		root.left.right.right = new Node(14); */

		root.right = new Node(3);
		
		int leafCount = getLeafCount(root);
		System.out.println(leafCount);
	}
	
	public static int getLeafCount(Node root)
	{
		if(root.left == null && root.right == null)
			return 1;
		else
			return getLeafCount(root.left) + getLeafCount(root.right);
		
	}
	

}
